home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / TimGA 1.2.1 / .h / CFitness.h < prev    next >
Encoding:
Text File  |  1997-07-16  |  2.9 KB  |  67 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CFitness.h        ©1995-97 Timo Eloranta            All rights reserved.
  3. // ===========================================================================
  4. //    This class is used for storing the fitness of a single graph drawing,
  5. //    as well as for comparing the quality of different drawings.
  6.  
  7. #pragma once
  8.  
  9. #include "MyStructs.h"
  10.  
  11. #include <PP_Types.h>
  12.  
  13. class CFitness
  14. {
  15.     private:
  16.         Int32        mCrossings,                // Nbr of edge crossings
  17.                     mEdgeDeviation,            // Edge length deviation (sum)
  18.                     mMinNodeDistance,        // Distance between the
  19.                                             // closest pair of nodes
  20.                     mMinDistSum,            // Sum of minimum node-to-node
  21.                                             // distances
  22.                     mSecondValue;            // Value of the fitness function
  23.  
  24.         static SEvaluation *sEvaluation;    // Ptr to an evaluation struct
  25.  
  26.     public:
  27.                 CFitness();
  28.     
  29.         void     SetCrossings( Int32 inCrossings )
  30.                     { mCrossings = inCrossings; };
  31.  
  32.         void     SetEdgeStuff( Int32 inDeviation )
  33.                     { mEdgeDeviation = inDeviation; };
  34.  
  35.         void    SetMinDistance(    Int32 inMinDist, 
  36.                                 Int32 inMinDistSum = 0,
  37.                                 Int16 inNodes = 0,
  38.                                 Int16 inGridSize = 0 );
  39.  
  40.         static    void SetEvalStruct( SEvaluation *inEvalStruct )
  41.                     { sEvaluation = inEvalStruct; };
  42.  
  43.         static    Boolean CrossingsRule()
  44.                     { return sEvaluation -> crossingsRule; }
  45.  
  46.         CFitness &operator=( const CFitness & inFitness);
  47.         
  48.         Int32     GetCrossings() const
  49.                     { return mCrossings; };
  50.         Int32    GetDeviation() const
  51.                     { return mEdgeDeviation; };
  52.         Int32    GetMinDistance() const
  53.                     { return mMinNodeDistance; };
  54.         Int32    Get2ndValue() const
  55.                     { return mSecondValue; };
  56.         
  57.         Boolean    operator==( const CFitness & inFitness ) const;
  58.         Boolean    operator<(  const CFitness & inFitness ) const;
  59. };
  60.  
  61. // ===========================================================================
  62. // • Inline Functions
  63. // ===========================================================================
  64.  
  65. // ———————————————————————————————————————————————————————————————————————————
  66. //    •    operator==
  67. // ———————————————————